package com.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.service.DepServiceImpl;
import com.vo.ResponseBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin("*")
public class DepController {


    @Autowired
    private DepServiceImpl depService;

    @RequestMapping("/hello")
    public String hell0(){
        return "hello";
    }

    @GetMapping("/findAllDep")
    public ResponseBean findAllDep(){
        List list=depService.findAll();
        System.out.println(list);
        return new ResponseBean(0,0,list);
    }

        @RequestMapping("search")
    public ResponseBean search(@RequestParam(defaultValue = "1")int page,@RequestParam(defaultValue = "2")int limit,Integer depId,String depName){
        IPage r=depService.search(page,limit,depId,depName);
        return new ResponseBean(0,r.getTotal(),r.getRecords());
    }

}
